# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.dm.dm_waybill_trace_dt import jms_dm__dm_waybill_trace_dt
from jms.ods.lmdm.yl_lmdm_sys_network_expand import jms_ods__yl_lmdm_sys_network_expand
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator

jms_dm__dm_collect_duration_dt = SparkSqlOperator(
    task_id='jms_dm__dm_collect_duration_dt',
    email=['shenjiaming@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_collect_duration_dt_{{ execution_date | cst_ds }}',
    sql='jms/dm/dm_collect_duration_dt/execute.sql',
    yarn_queue='pro',
    driver_memory='2G',
    executor_memory='4G',
    executor_cores=4,
    pool_slots=4,
    conf={'spark.executor.memoryOverhead': '2G',
          'spark.dynamicAllocation.enabled': 'true',
          'spark.shuffle.service.enabled': 'true',
          'spark.dynamicAllocation.maxExecutors': 15,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 20,
          },
    execution_timeout=timedelta(minutes=30),
)

jms_dm__dm_collect_duration_dt << [
    jms_dm__dm_waybill_trace_dt,
    jms_ods__yl_lmdm_sys_network_expand,
]
